//
// NeL - bindings
// Copyright (C) 2010 Naush
//
//This program is free software: you can redistribute it and/or modify
//it under the terms of the GNU Affero General Public License as
//published by the Free Software Foundation, either version 3 of the
//License, or (at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU Affero General Public License for more details.
//
//You should have received a copy of the GNU Affero General Public License
//along with this program.  If not, see <http://www.gnu.org/licenses/>.

package org.ryzom.nel.misc;

public class CFile {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public CFile(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(CFile obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nelmiscJNI.delete_CFile(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public static String getFilename(String filename) {
    return nelmiscJNI.CFile_getFilename(filename);
  }

  public static String getPath(String filename) {
    return nelmiscJNI.CFile_getPath(filename);
  }

  public static boolean isDirectory(String filename) {
    return nelmiscJNI.CFile_isDirectory(filename);
  }

  public static boolean fileExists(String filename) {
    return nelmiscJNI.CFile_fileExists(filename);
  }

  public static boolean isExists(String filename) {
    return nelmiscJNI.CFile_isExists(filename);
  }

  public static boolean createEmptyFile(String filename) {
    return nelmiscJNI.CFile_createEmptyFile(filename);
  }

  public static String findNewFile(String filename) {
    return nelmiscJNI.CFile_findNewFile(filename);
  }

  public static int getLastSeparator(String filename) {
    return nelmiscJNI.CFile_getLastSeparator(filename);
  }

  public static String getFilenameWithoutExtension(String filename) {
    return nelmiscJNI.CFile_getFilenameWithoutExtension(filename);
  }

  public static String getExtension(String filename) {
    return nelmiscJNI.CFile_getExtension(filename);
  }

  public static long getFileSize(String filename) {
    return nelmiscJNI.CFile_getFileSize__SWIG_0(filename);
  }

  public static long getFileSize(SWIGTYPE_p_FILE f) {
    return nelmiscJNI.CFile_getFileSize__SWIG_1(SWIGTYPE_p_FILE.getCPtr(f));
  }

  public static long getFileModificationDate(String filename) {
    return nelmiscJNI.CFile_getFileModificationDate(filename);
  }

  public static boolean setFileModificationDate(String filename, long modTime) {
    return nelmiscJNI.CFile_setFileModificationDate(filename, modTime);
  }

  public static long getFileCreationDate(String filename) {
    return nelmiscJNI.CFile_getFileCreationDate(filename);
  }

  public static void addFileChangeCallback(String filename, SWIGTYPE_p_f_r_q_const__std__string__void arg1) {
    nelmiscJNI.CFile_addFileChangeCallback(filename, SWIGTYPE_p_f_r_q_const__std__string__void.getCPtr(arg1));
  }

  public static void removeFileChangeCallback(String filename) {
    nelmiscJNI.CFile_removeFileChangeCallback(filename);
  }

  public static void checkFileChange(SWIGTYPE_p_TTime frequency) {
    nelmiscJNI.CFile_checkFileChange__SWIG_0(SWIGTYPE_p_TTime.getCPtr(frequency));
  }

  public static void checkFileChange() {
    nelmiscJNI.CFile_checkFileChange__SWIG_1();
  }

  public static boolean copyFile(String dest, String src, boolean failIfExists, IProgressCallback progress) {
    return nelmiscJNI.CFile_copyFile__SWIG_0(dest, src, failIfExists, IProgressCallback.getCPtr(progress), progress);
  }

  public static boolean copyFile(String dest, String src, boolean failIfExists) {
    return nelmiscJNI.CFile_copyFile__SWIG_1(dest, src, failIfExists);
  }

  public static boolean copyFile(String dest, String src) {
    return nelmiscJNI.CFile_copyFile__SWIG_2(dest, src);
  }

  public static boolean quickFileCompare(String fileName0, String fileName1) {
    return nelmiscJNI.CFile_quickFileCompare(fileName0, fileName1);
  }

  public static boolean thoroughFileCompare(String fileName0, String fileName1, long maxBufSize) {
    return nelmiscJNI.CFile_thoroughFileCompare__SWIG_0(fileName0, fileName1, maxBufSize);
  }

  public static boolean thoroughFileCompare(String fileName0, String fileName1) {
    return nelmiscJNI.CFile_thoroughFileCompare__SWIG_1(fileName0, fileName1);
  }

  public static boolean moveFile(String dest, String src) {
    return nelmiscJNI.CFile_moveFile(dest, src);
  }

  public static boolean createDirectory(String dirname) {
    return nelmiscJNI.CFile_createDirectory(dirname);
  }

  public static boolean createDirectoryTree(String dirname) {
    return nelmiscJNI.CFile_createDirectoryTree(dirname);
  }

  public static boolean setRWAccess(String filename) {
    return nelmiscJNI.CFile_setRWAccess(filename);
  }

  public static boolean deleteFile(String filename) {
    return nelmiscJNI.CFile_deleteFile(filename);
  }

  public static boolean deleteDirectory(String filename) {
    return nelmiscJNI.CFile_deleteDirectory(filename);
  }

  public static void getTemporaryOutputFilename(String originalFilename, SWIGTYPE_p_std__string tempFilename) {
    nelmiscJNI.CFile_getTemporaryOutputFilename(originalFilename, SWIGTYPE_p_std__string.getCPtr(tempFilename));
  }

  public CFile() {
    this(nelmiscJNI.new_CFile(), true);
  }

}
